import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
const about=()=>import("../views/About.vue")
const index=()=>import("../pages/index.vue")
const shouye=()=>import("../pages/shouye.vue")
const gouwu=()=>import("../pages/gouwu.vue")
const wode=()=>import("../pages/wode.vue")
const fenlei=()=>import("../pages/fenlei.vue")
const xiangqing=()=>import("../pages/xiangqing.vue")
const liebiao=()=>import("../pages/leimiao.vue")
const login=()=>import("../pages/login.vue")
const zhuce=()=>import("../pages/zhuce.vue")

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    name: 'Home',
    component: about
  },
  {
    path: '/xiang/:id',
    name: 'xinagqiang',
    component: xiangqing
  },
  {
    path: '/login',
    name: 'login',
    component: login
  },
  {
    path: '/zhuce',
    name: 'zhuce',
    component: zhuce
  },
  {
    path: '/index',
    name: 'index',
    component: index,
    children:[
    {path:"shouye",component:shouye},
    {path:"wode",component:wode},
    {path:"gouwu",component:gouwu},
    {path:"go/:id",component:liebiao},
    {path:"fenlei",component:fenlei,}
]
  }
]


const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default router
